package Stub;

//import com.sta3d.serveratm.*;

import serveratm.ServerPerformer;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created with IntelliJ IDEA.
 * User: Stasico
 * Date: 14.01.14
 * Time: 23:04
 * To change this template use File | Settings | File Templates.
 */

public class ClientSideStub implements Runnable {
    public enum Keywords {
        ;
        public static final String WAITING_CONNECTION = "\nMOCK - Server Started, starting story logs \nWaiting for client connection ...";
        public static final String CONNECTED = "Client is connected TO MOCK Server ";
    }

    ;

    public void run() {
        try {
            ServerSocket soc = new ServerSocket(7001);
            System.out.println(soc + Keywords.WAITING_CONNECTION);
            for (; ; ) {
                Socket socket = soc.accept();
                System.out.println(Keywords.CONNECTED);
                new ServerPerformer(socket);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
